﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.ServiceProcess;

namespace MediaLibraryManager.Service
{
	[RunInstaller(true)]
	public partial class ProjectInstaller : Installer
	{
		public ProjectInstaller()
		{
			InitializeComponent();
		}

		private void serviceInstaller_AfterInstall(object sender,InstallEventArgs e)
		{
			ServiceController controller = new ServiceController(serviceInstaller.ServiceName);
			controller.Start();
		}

		private void serviceInstaller_BeforeUninstall(object sender,InstallEventArgs e)
		{
			ServiceController controller = new ServiceController(serviceInstaller.ServiceName);

			if (controller.Status == ServiceControllerStatus.Running)
				controller.Stop();
		}
	}
}
